package com.leyou.item.api;

import com.leyou.common.entity.MyPage;
import com.leyou.common.entity.MyPage1;
import com.leyou.item.entity.TbSku;
import com.leyou.item.entity.TbSpu;
import com.leyou.item.entity.TbSpuBo;
import com.leyou.item.entity.TbSpuDetail;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

public interface GoodsApi {

    //查询spu信息
    @GetMapping("/spu/page")
    public MyPage<TbSpuBo> querySpuByKey(
            @RequestParam(value = "key",required = false) String key,
            @RequestParam(defaultValue = "1")int page,
            @RequestParam(defaultValue = "5")int rows,
            @RequestParam(value = "saleable",required = false) Boolean saleable
    );


    //查询spu信息
    @GetMapping("/spu/page1")
    public MyPage1<TbSpuBo> querySpuByKey1(
            @RequestParam(value = "key",required = false) String key,
            @RequestParam(defaultValue = "1")int page,
            @RequestParam(defaultValue = "5")int rows,
            @RequestParam(value = "saleable",required = false) Boolean saleable
    );


    //根据spu查询sku集合
    @GetMapping("sku/list")
    List<TbSku> querySkusBySpuId(@RequestParam("id") Long id);


    //根据spuId获取spu详细信息
    @GetMapping("spu/detail/{id}")
    TbSpuDetail querySpuDetailById(@PathVariable("id") Long id);

    //根据主键id获取spu
    @GetMapping("spu/{id}")
    TbSpu querySpuById(@PathVariable("id") Long id);


}
